<!DOCTYPE html>
<html>
<head>
    <title>订单结算</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="keywords" content=""/>
    <meta name="description"
          content=""/>
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">

    <meta name="format-detection" content="telephone=no"/>
    <link rel="stylesheet" href="/Public/css.css"/>

</head>
<body id="orderAccount">
<script type="text/javascript">
    (function () {
        document.documentElement.style.fontSize = (document.body.offsetWidth/320) * 14 + 'px';
    })()
</script>
<div class="header">
    
    <a href="javascript:history.back(-1);" class="backbtn_02"></a>订单结算
    
</div>
<div id="main" address_id="{$user_address_en.address_id}" class="content2">
    <!---->
    
    	<if condition="empty($user_address_en)">
    		 <div class="order_user">
    		 	<a href="/buy/addressList?lst_sku={$lst_sku}&user_id={$user_id}" class="btn_address">选择地址</a>
   		 	 </div>
    	<else />
    		<a href="/buy/addressList?lst_sku={$lst_sku}&user_id={$user_id}" class="order_user">
		        <p><span class="order_name">收货人：{$user_address_en.consignee_name}</span>
    			<span class="order_tel">{$user_address_en.consignee_cellphone}</span></p>
        		<p class="order_address">{$user_address_en.consignee_province} {$user_address_en.consignee_city} {$user_address_en.consignee_district} {$user_address_en.consignee_address}</p>
		    </a>
    	</if>
    
    <!---->
    <div class="prodbox">
        <div class="hd"> <span class="t1">商品列表</span> <span class="t2">共{$all_goods_qty}件商品</span></div>
        <ul class="prodlist">
            <volist name='lst_buy_sku' id='sku_en'>
            <li sku_id="{$sku_en.sku_id}">
                <div class="prodimg">
                    <img src="{$sku_en.image}" alt=""/>
                </div>
                <div class="proddetail">
                    <p class="prodname">{$sku_en.style_name}</p>
                    <p class="prodes">{$sku_en.promotion_text}</p>
                    <p class="price">￥{$sku_en.sale_price}</p>
                    <p class="prod_num">x<span class="qty">{$sku_en.qty}</span></p>
                </div>
            </li>
            </volist>
        </ul>
    </div>

    <ul class="order_sub">
        <li><span class="sub_tit">配送方式</span> <span class="sub_selct">快递</span></li>
        <!-- <li><a href=""><span class="sub_tit">送货时间</span> <span class="sub_selct">任意时间</span></a></li> -->
        <!-- <li><a href=""><span class="sub_tit">发票</span> <span class="sub_selct">公司</span></a></li> -->
    </ul>
<!---->
    <dl class="payment">
        <dt>支付方式</dt>
        <dd>
            <img src="/Public/images/zfb.jpg" alt="" class="pay_company"/>
            <input type="radio" checked="checked" class="radio2"/>
        </dd>
    </dl>

    <!---->

  <div class="paytotal">
      <p><span class="t_dt">商品金额</span><span class="t_dd">￥{$sku_amount}</span></p>
      <p><span class="t_dt">折扣金额</span><span class="t_dd">￥{$promotion_amount}</span></p>
      <p><span class="t_dt">运费合计</span><span class="t_dd">￥0.00</span></p>
      <p><span class="t_dt" style="color:#ef4b4b;font-weight:bold;">需要支付</span><span class="t_dd" style="color:#ef4b4b;font-weight:bold;">￥{$order_amount}</span>
      </p>
  </div>

</div>
<div class="cartfix">
    <div class="cart_des" style="padding:0;">
        <span class="">商品：￥<span class="sku_amount">{$sku_amount}</span></span>
        <span class="cart_total">折扣：￥<span class="discount_amount">{$promotion_amount}</span></span>
		<span class="cart_total">合计：￥<span class="total_amount">{$order_amount}</span></span>
    </div>
    <a id="btn_checkout" href="#" class="check_total">结算</a>
</div>

<script type="text/javascript" src="/Public/js/zepto.js"></script>
<script type="text/javascript" src="/Public/js/wj.js"></script>
<include file="common:server_config" />
<script type="text/javascript" src="/Public/js/ajaxService.js"></script>
<script type="text/javascript" src="/Public/js/common.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$('#btn_checkout').bind('click', function(){
		var address_id = $('#main').attr('address_id');
		var lst_sku = new Array();
		$('.prodlist li').each(function(){
			$qty = $(this).find('.qty').text();
			var sku_id = $(this).attr('sku_id');
			lst_sku.push(sku_id + "," + $qty);
			
		});
		
		var result = OrderService.SubmitOrder(address_id, lst_sku.join('|'));
		
		if(result.IsSuccess == 0){
			alert(result.ErrorMsg);
			return;
		}
		else{
			window.location.href = result.Result;
		}
		
	});
});
</script>
</body>
</html>